<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<s:url value="/css/style.css"/>" rel="stylesheet"
			type="text/css" />
		
		<script type="text/javascript"
			src="<s:url value="/js/jquery-1.3.2.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.bgiframe.min.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.ajaxQueue.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/thickbox-compressed.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/autocomplete/jquery.autocomplete.js"/>"></script>
		<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/jquery.autocomplete.css"/>" />
		<link rel="stylesheet" type="text/css"
			href="<s:url value="/js/autocomplete/thickbox.css"/>" />
		<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
		<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript"
			src="<s:url value="/js/jquery.blockUI.js"/>"></script>
		<script type='text/javascript'
			src="<s:url value="/js/tableSel.js"/>"></script>
		
		<script type="text/javascript">
		function dosubmit(){
		    $('#listForm').submit();
		}
		function goAssignToTM(form){
			form = document.getElementById('listForm');
			var ids = getSelectionIds('a');
			if(ids.length<1){
				alert('Please select one at least.');
			}else{
				form.action=form.action.replace('list','assignToTm');
				$('#ids').val(ids);
				form.submit();
			}
		}
		function changedisplay(el){
			el.toggle("fast",function() {
				 //$Container.getContainerProxy().resize();
			});
		}
		$(document).ready(function(){
		    $('#selCreateStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selCreateEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selLastTouchStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selLastTouchEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selSetApptStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selSetApptEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selShowStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selShowEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selPayStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selPayEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selAssignCrStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selAssignCrEndTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selInitVisitStartTime').datepicker( {dateFormat :'yy-mm-dd'});
		    $('#selInitVisitEndTime').datepicker( {dateFormat :'yy-mm-dd'});
            $("#selMarketingPlan").autocomplete("<s:url value="/marketing/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selMarketingPlan").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selMarketingPlanId").val(d.id);
            });
            $("#selAdChannel").autocomplete("<s:url value="/data/AdChannel/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selAdChannel").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selAdChannelId").val(d.id);
            });
            $("#selPTE").autocomplete("<s:url value="/data/PTE/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selPTE").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selPTEId").val(d.id);
            });
             $("#selCreateUser").autocomplete("<s:url value="/system/User/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selCreateUser").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selCreateUserId").val(d.id);
            });
             $("#selCC").autocomplete("<s:url value="/system/User/autoCompleteCCAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
             $("#selCC").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selCCId").val(d.id);
            });
             $("#selCR").autocomplete("<s:url value="/system/User/autoCompleteCRAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name+" "+d.wno;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name+" "+d.wno;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
             $("#selCR").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selCRId").val(d.id);
            });
                 $("#selPTELead").autocomplete("<s:url value="/data/PTE/autoCompleteAjax.action"/>", {
               width: 300,
               minChars:2, //几个字
               mastMatch:true,
               selectFirst: false,
               max:  20,
           	   formatItem: function(row, i, max) {
           	      var d=eval("("+row+")");
			      return  d.name+" "+d.wno;
	          },
		      formatMatch: function(row, i, max) {
		         var d=eval("("+row+")");
 			     return d.name+" "+d.wno;
		      },
		      formatResult: function(row) {
		         var d=eval("("+row+")");
			     return d.name;
     	       }
            });
            $("#selPTELead").result(function(event, data, formatted) {
           	      var d=eval("("+data+")");
		          $("#selPTELeadId").val(d.id);
            });
        });
        function doCall(id){
			var url = '<s:url value="/customer/PersonalTouch/call?id="/>'+id;
			$('#'+id).find('td').attr('class','tablecolour1');
			window.open(url);
		};
		 function doEdit(id){
			var url = '<s:url value="/customer/PersonalTouch/edit?id="/>'+id;
			$('#'+id).find('td').attr('class','tablecolour1');
			window.open(url);
		}
		</script>
		<title><s:text name="system.title" />
		</title>
	</head>
	<body>
		<s:include value="/common/up.jsp"></s:include>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td class="box">
					<s:form action="PersonalTouch/list" name="listForm" id="listForm"
						namespace="/customer">
						<input type="hidden" id="startIndex" name="startIndex" value="0" />
						<s:hidden name="ids" id="ids" />
						<table width="100%" border="0" cellpadding="0" cellspacing="0"
							class="searchbg">
							<tr>
								<td>
								    Name :
									<s:textfield  id="selName"  size="15" name="name" />
								    Card:
									<s:textfield  id="selCard"  size="15" name="eliteCard" />
								    &nbsp;Status:
									<s:select  id="selLeadsStatus" name="leadsStatus" listKey="name()"
									    headerKey="" headerValue="--all--"
										list="@com.ef.constant.ELeadsStatus@values()"></s:select>
									&nbsp;Source:
									<s:select id="selLeadsSource"  name="leadsSource"  listKey="name()"
										    headerKey="" headerValue="--all--"
											list="@com.ef.constant.ELeadsSource@values()"></s:select>
									<img src="<s:url value="/img/right/btns.gif"/>" border="0"  style="cursor:pointer"
										align="absmiddle" onclick="javascript:dosubmit();" />
									<img src="<s:url value="/img/right/btn-s2.gif"/>" border="0" style="cursor:pointer"
										align="absmiddle" onclick="javascript:changedisplay($('#div1'));"/> 
									<img src="<s:url value="/img/right/btn4.gif"/>" border="0"  style="cursor:pointer"
										align="absmiddle" onclick="javascript:reset2();" />
                 				</td>
							</tr>
						</table>
						<div id='div1' style="display: none;">
							<table width="100%" border="0" cellpadding="0" cellspacing="0"
								bgcolor="#E0F5FF">
								<tr>
									<td height="40">
									    &nbsp;Tel:
									    <s:textfield  id="selTelephone" size="15" name="telephone" />
									    &nbsp;Type:
										<s:select  id="selLeadsType" name="leadsType" listKey="name()"
										    headerKey="" headerValue="--all--"
											list="@com.ef.constant.ELeadsType@values()"></s:select>
										&nbsp;Ad Channel:
										<s:textfield id="selAdChannel"  name="adChannel.name" cssClass="input2" size="13" />
										<s:hidden id="selAdChannelId" name="adChannel.id"/>
									</td>
								</tr>
								<tr>
									<td height="40">
									     &nbsp;MarketingPolicy:
										<s:select  id="selMarketingPolicy"  name="marketingPolicy.id" 
										    headerKey=""  headerValue="--all--"
											list="marketingPolicyList"></s:select>
									   &nbsp;PTE Lead:
										<s:textfield id="selPTELead"  name="pteLeader.name" cssClass="input2" size="13" />
										<s:hidden id="selPTELeadId" name="pteLeader.id"/>
									    &nbsp;PTE:
										<s:textfield id="selPTE"  name="pte.name" cssClass="input2" size="13" />
										<s:hidden id="selPTEId" name="pte.id"/>
										&nbsp;Init Visit Time:
										<s:textfield  id="selInitVisitStartTime" name="selInitVisitStartTime" cssClass="input2" size="13" />-
										<s:textfield  id="selInitVisitEndTime" name="selInitVisitEndTime" cssClass="input2" size="13" /> 
									</td>
								</tr>
								<tr>
									<td height="40">
										&nbsp;CreateUser:
										<s:textfield  id="selCreateUser" name="createUser.name" cssClass="input2" size="10" /> 
										<s:hidden id="selCreateUserId" name="createUser.id"/>
										&nbsp;CreateTime:
										<s:textfield  id="selCreateStartTime" name="selCreateStartTime" cssClass="input2" size="10" />-
										<s:textfield  id="selCreateEndTime" name="selCreateEndTime" cssClass="input2" size="10" /> 
										&nbsp;CC :
										<s:textfield  id="selCC" name="cc.name" cssClass="input2" size="10" /> 
										<s:hidden id="selCCId" name="cc.id"/>
										&nbsp;CR :
										<s:textfield  id="selCR" name="cr.name" cssClass="input2" size="10" /> 
										<s:hidden id="selCRId" name="cr.id"/>
										&nbsp;LastTouchTime:
										<s:textfield  id="selLastTouchStartTime" name="selLastTouchStartTime" cssClass="input2" size="10" />-
										<s:textfield  id="selLastTouchEndTime" name="selLastTouchEndTime" cssClass="input2" size="10" /> 
									</td>
								</tr>
								<tr>
									<td height="40">
									  	&nbsp;Show Time:
										<s:textfield  id="selShowStartTime" name="selShowStartTime" cssClass="input2" size="10"/>-
										<s:textfield  id="selShowEndTime"name="selShowEndTime" cssClass="input2" size="10"/>
										&nbsp;Pay Time:
										<s:textfield  id="selPayStartTime" name="selPayStartTime" cssClass="input2" size="10" />-
										<s:textfield  id="selPayEndTime"name="selPayEndTime" cssClass="input2" size="10" />
										&nbsp;CR Assign Time:
										<s:textfield  id="selAssignCrStartTime" name="selAssignCrStartTime" cssClass="input2" size="10" />-
										<s:textfield  id="selAssignCrEndTime"name="selAssignCrEndTime" cssClass="input2" size="10" />
									</td>
								</tr>
							</table>
						</div>
						<table width="100%" border="0" cellpadding="0" cellspacing="1"
							class="box2">
							<tr>
								<td width="33" class="tablecolour1">
								    &nbsp;
								</td>
								<td class="tablecolour1">
									Name
								</td>
							 	<td class="tablecolour1">
									Telephone
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									EliteCard
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Leads Source
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									TouchTime
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Last Comments
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									CC
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									CR
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Assign Time
								</td>
								<td class="tablecolour1" nowrap="nowrap">
									Function
								</td>
							</tr>
							<s:iterator value="listResult.items" status="status">
								<tr id='<s:property value="id" />'>
									<td class="tablecolour2">
									   <s:property value="#status.index+1" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="name" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="mobileTelephone" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="eliteCard" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="leadsSource" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:date name="lastEventTime" format="yyyy-MM-dd H:mm"/>
									</td>
									<td class="tablecolour2" >
										<s:property value="lastEventCommons" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="cc.name" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:property value="cr.name" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<s:date name="crAssignTime" format="yyyy-MM-dd" />
									</td>
									<td class="tablecolour2" nowrap="nowrap">
										<a href='javascript:doCall(<s:property value="id" />)'>Call</a>|
										<a
											href='javascript:doEdit(<s:property value="id" />)'>Edit</a>
									</td>
								</tr>
							</s:iterator>
						</table>
						<s:include value="/common/page.jsp"></s:include>
					</s:form>
				</td>
			</tr>
		</table>
		<s:include value="/common/down.jsp"></s:include>
	</body>
</html>